﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using ViewModel.Finance;

namespace ViewModel.Admin
{
    public class SectionViewModel : SectionWorkspaceViewModel
    {
        public SectionViewModel(MainWindowViewModel mainWindowViewModel)
        {
            if (mainWindowViewModel == null) throw new ArgumentNullException();

            this.MainWindowViewModel = mainWindowViewModel;
        }

        public override ReadOnlyCollection<CommandViewModel> Commands
        {
            get
            {
                if (_commands == null)
                {
                    List<CommandViewModel> cmds = CreateFeatureCommands();
                    _commands = new ReadOnlyCollection<CommandViewModel>(cmds);
                }
                return _commands;
            }
        }

        private List<CommandViewModel> CreateFeatureCommands()
        {
            return new List<CommandViewModel>
                       {
                           new CommandViewModel( "Frequency", new RelayCommand(param => ShowFequencyList()))
                       };
        }

        private FrequencyListViewModel frequencyListViewModel;
        private void ShowFequencyList()
        {
            if (frequencyListViewModel == null)
            {
                frequencyListViewModel = new FrequencyListViewModel();
            }
            MainWindowViewModel.ShowWorkspace(frequencyListViewModel);
        }
    }
}
